package com.zwj.config;

import com.aliyun.oss.OSSClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class OSSClientFactory {

    @Autowired
    private OSSConfig ossConfig;
    private volatile OSSClient ossClient;

    public OSSClientFactory(){

    }

    public OSSClient getInstance() {
        return new OSSClient(
                ossConfig.getEndpoint(),
                ossConfig.getAccessKeyId(),
                ossConfig.getSecretAccessKey());
    }

    /**
     * BucketName名称
     *
     * @return
     */
    public String getBucketName(){
        return ossConfig.getBucketName();
    }
}
